package com.itheima.demo;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import com.itheima.Mapper.OrdersAndUserMapper;
import com.itheima.domain.OrdersAndUser;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;

public class Demo1 {
    public static void main(String[] args) throws IOException {
        InputStream is = Resources.getResourceAsStream("sql.xml");
        SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(is);
        SqlSession session = factory.openSession();
        OrdersAndUserMapper mapper = session.getMapper(OrdersAndUserMapper.class);
        List<OrdersAndUser> all = mapper.findAll();
        System.out.println(all);
//        List<OrdersAndUser> list = session.selectList("findAll");
//        System.out.println(list);
        session.close();

    }
}
